home *** CD-ROM | disk | FTP | other *** search
- Path: uni-erlangen.de!winx03!sunshine!schoof
- From: schoof@informatik.uni-wuerzburg.de (Jochen Schoof)
- Newsgroups: comp.lang.c
- Subject: Re: Q: realloc->free?
- Date: 16 Jan 1996 15:52:38 GMT
- Organization: University of Wuerzburg, Germany
- Message-ID: <4dghk7$d57@winx03.informatik.uni-wuerzburg.de>
- References: <4daa2e$oh5@axe.netdoor.com> <4de8uv$48j@bs33n.staffs.ac.uk>
- NNTP-Posting-Host: wi2x01.informatik.uni-wuerzburg.de
- X-Newsreader: TIN [version 1.2 PL2]
-
- Wildfire (cm4bctrd@bs47c.staffs.ac.uk) wrote:
- : Right. I could be wrong in what I'm about to say, but I *think* this is
- : correct.
-
- If you have any doubt about the correctness of you post - DON'T POST!
-
- : If you think about it, there is no need for realloc() to move the *start*
- : of the allocated memory - it may need to make a link between the end of
- : the original memory block and the start of an extension block, but that's
- : different.
-
- This is one solution of doing it (and let me add it is a strange one),
- but no one guarantees that some machine uses this technique. The machine
- and operating system I'm using always provide one single block of
- memory when using any member of the malloc()-family - and so do most
- systems.
-
- : So b is either going to be NULL or a.
-
- Speaking for realloc() in general this is complete nonsense.
-
- : realloc() does no free()ing, as far as I know, since the contents of
- : memory are unchanged.
-
- This is wrong, too. It is even possible, that realloc moves the contents
- of the old memory block if you call realloc() with the exact size of the
- block. On most UNIX system doubling or halving the size of a memory
- block will result in its contents being moved.
-
- : I would really like someone who properly knows about this to confirm or
- : correct what I'm saying.
-
- The details are highly system specific and therefore should not be dis-
- cussed in comp.lang.c You'll only get information on what your realloc()
- does by reading your compiler's documentation. The general part is covered
- in K&R2 on page 252 (I finally got an English version).
-
- - Jochen
-
- --
- --------------------------------------------------------------------------
- Jochen Schoof mailto:schoof@informatik.uni-wuerzburg.de
- Lehrstuhl fuer Informatik II +-------------------------------------------
- Universitaet Wuerzburg | You are just reading a .sig-light:
- D-97074 Wuerzburg (Germany) | It is free of fat, sugar and cholesterol!
- ------------------------------+-------------------------------------------
- WWW-Homepage: http://www.informatik.uni-wuerzburg.de/staff/joscho
- --------------------------------------------------------------------------
-